﻿<%@ Page Language="C#" AutoEventWireup="true" Inherits="DeliverGoodsManagement_Invoices" Codebehind="Invoices.aspx.cs" %>

<%@ Register Src="../Controls/SENDDOCListControl.ascx" TagName="SENDDOCListControl"
    TagPrefix="uc1" %>
<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
    <script type="text/javascript" src="../Include/Js/OpenWindow.js"></script>
    <script type="text/javascript" src="../Include/JS/Lib/jquery-1.1.4.js"></script>
    <script type="text/javascript">
    var  $j = jQuery.noConflict();
       function setVIPValue(p)
       {
            var gk=p.split("|");
            document.getElementById("txtCustomerId").innerText=gk[0];
       }
     function KeyUp() 
     {  

      if (event.keyCode == 13)
       {
           event.returnValue=false;
           document.getElementById("btnSearch").click();
        }  
    }  

       function Mask()
        {
            var div_back = document.getElementById("div_background");
            div_back.style.display = "block"; 
        }

        function HidMask()
        {
            var div_back = document.getElementById("div_background");
            div_back.style.display = "none";    
        }
        function Statistics()
        {debugger;
            window.open("../Report/UnSendOrder.aspx","","","");
            document.getElementById('btnSearch').click();
            window.location.reload();
        }
       function checkEnd()
       {
            <%= ClientScript.GetCallbackEventReference(this, "", "GetData", "")%>; 
       }
       function GetData(result)
       {
            if(result.length>0)
            {
                var arr=result.split("|");
                if(arr[1]=="1")
                {debugger;
                    if(confirm(arr[2]+"批次已经发出"+arr[0]+"张订单,确定要结束吗?"))
                    {
                        document.getElementById("btnEnd").click();
                    }
                }
                else
                {
                    alert(arr[0]); return;
                }
            }
       }
       
       function InitPICI(start,end)
       {debugger;
            $j.post("../Handler/PICIHandler.ashx",{"start":start,"end":end},
            function(data)
            {debugger;
                var sel=document.getElementById("dropPCH");
                if(data.length>0)
                {   
                    sel.options.length=0;//清空
                    sel.options.add(new Option("请选择","1"));   
                    var arr=data.split(",");
                    for(var i=0;i<arr.length-1;i++)
                    {
                        sel.options.add(new Option(arr[i],arr[i]));   
                    }
                }
                else
                {
                    sel.options.length=0;//清空
                    sel.options.add(new Option("请选择","1")); 
                }
            });
       }
       function selPCH(value)
       {
            document.getElementById("hdPCH").value=value;
       }
    </script>
    <script type="text/javascript" src="../Include/Js/SocanCode.js"></script>
    <script type="text/javascript" src="../Include/Js/PopupCalendar.js"></script>
<style type="text/css">
body {font-size:12px;margin:0;padding:0;}
a:visited{text-decoration:none;color:slategray;}
a:hover{text-decoration:underline;color:slategray;}
a:link{text-decoration:none;color:slategray;}
.juli {margin-top:10px;padding-left:20px;}
.z1{background-color:#e7e7e7; text-align:left; line-height:20px;}
.z2{background-color:#FFFFFF; text-align:left; line-height:20px;}
.zt3 {text-align:center; font-weight:600; color:#000000;}
.zt4 {text-align:center; color:#000000;}
.zt5 {text-align:right; color:#000000;}
.tb {width: 1100px; background-color:#999999;}
a.lj {font-size:12px; color:#ff9900; text-decoration:underline;}
a.lj:link {font-size:12px; color:#ff9900; text-decoration:underline;}
a.lj:visited {font-size:12px; color:#ff9900; text-decoration:underline;}
a.lj:hover {color:#ff3300;}
a.lj:active {color:#ff3300;}
.menu_bg { background-color:#fef3bb; padding-left:20px;padding-top:6px; padding-bottom:6px;border-bottom:#cf994b 1px solid; width:1100px;}
.menu_bg5 { background-color:#fef3bb; padding-left:20px;padding-top:6px; padding-bottom:6px;border-bottom:#cf994b 0px solid; width:1100px;}
.input_button {width:52px;height:23px;border:none;cursor:pointer; background:#ffffff url(../Include/Images/bt.gif) no-repeat;}
.input_longtextbutton {width:74px;height:23px;border:none;cursor:pointer; background:#ffffff url(../Include/Images/bt1.gif) no-repeat;}
.input_button1 {width:52px;height:23px;border:none;cursor:pointer; background:#ffffff url(../Include/Images/bt.gif) no-repeat;font-weight:bold;}
.input_button3 {width:95px;height:23px;border:none;background:#ffffff url(../Include/Images/bt2.gif) no-repeat;}
h2 {padding-left:20px;padding-top:10px;margin:0; width:1100px; background: url(../Include/Images/menu_title.gif) repeat-x;height:21px;font-size:14px; font-weight:600;}
.divbackground
{
z-index:9;display:none;position:absolute;width:1120px;height:1040px;left:0px;top:0px;background-color:#8C8C8C;opacity: 0.5;filter:alpha(opacity=50,finishopacity=50,style=1);}
</style>   
</head>
<body onkeydown="KeyUp()">
    <form id="form1" runat="server">
    <div align="Justify">
    <h2>发货单</h2>
        <div class="menu_bg">
            <asp:Button ID="btnlock" runat="server"  CssClass="input_button" Text="锁定" OnClick="btnlock_Click" />&nbsp;
            <asp:Button ID="btnUnlock" runat="server" CssClass="input_button" Text="解锁" OnClick="btnUnlock_Click" />&nbsp;
            <asp:Button ID="btnPack" runat="server" Visible="false" CssClass="input_button" Text="打包" OnClientClick="javascript:window.open('PackOrder.aspx','','','')"/>
            <asp:Button ID="btnDeliver" CssClass="input_button" runat="server" Text="发货" OnClick="btnDeliver_Click" />&nbsp;
            <asp:Button ID="btnPrintExpress" CssClass="input_longtextbutton" runat="server" Text="打印物流单"
                OnClick="btnPrint_Click" />&nbsp;
            <asp:Button ID="btnPrintDeliver" runat="server" Text="打印配货单" CssClass="input_longtextbutton"
                OnClick="btnPrintDeliver_Click" />
            <asp:Button ID="btnUpdateTraner" CssClass="input_button3" runat="server" Text="修改配送方式"
                OnClick="btnUpdateTraner_Click" />
            <asp:Button ID="btnStatistics" Text="未发货汇总统计" CssClass="input_button3" runat="server"
                OnClientClick="Statistics()" />       
            <asp:Button ID="btnScanDelivery" CssClass="input_button3" Text="扫描出库" runat="server"  OnClientClick="javascript:window.open('ScanDelivery.aspx','','','')" />   
            <asp:Button ID="btnPrintOrder" CssClass="input_button3" Text="打印订货单" runat="server" OnClick="btnPrintOrder_Click" />
            <asp:Button ID="btnStart" CssClass="input_button" Text="开始" runat="server" OnClick="btnStart_Click" />
            <input id="End" type="button"  class="input_button" value="结束" onclick="checkEnd()" />
            <asp:Button ID="btnEnd" Width="1px" runat="server" OnClick="btnEnd_Click" />
            
            </div>
        <div class="menu_bg">
            订单编号：<asp:TextBox ID="txtOrderId" runat="server" Width="100px"></asp:TextBox>
            物流单号：<asp:TextBox ID="txtDeliverBillId" runat="server"></asp:TextBox>
            用户帐号：<asp:TextBox ID="txtCustomerId" runat="server" Width="100px"></asp:TextBox><asp:Button
                ID="btnChooseCustomer" CssClass="input_button1" runat="server" Text="..." OnClientClick="SearchVIP('../');" />
            用户昵称：<asp:TextBox ID="txtNickName" runat="server"></asp:TextBox>
            收货人：<asp:TextBox ID="txtReceiver" runat="server" Width="100px"></asp:TextBox><br />
            制单日期从：<asp:TextBox ID="txtOrderStartDate" runat="server" Width="100px" OnClick="getDateString(this,oCalendarChs)"></asp:TextBox>
            至<asp:TextBox ID="txtOrderEndDate" runat="server" Width="100px" OnClick="getDateString(this,oCalendarChs)"></asp:TextBox>
            
            发货日期从：<asp:TextBox ID="txtDeliverStartDate" runat="server" Width="100px" onclick="getDateString(this,oCalendarChs)" onpropertychange="InitPICI(this.value,document.getElementById('txtDeliverEndDate').value)"></asp:TextBox>
            至<asp:TextBox ID="txtDeliverEndDate" runat="server" Width="100px"  onclick="getDateString(this,oCalendarChs)"  onpropertychange="InitPICI(document.getElementById('txtDeliverStartDate').value,this.value)"></asp:TextBox>
            批次号：
            <select name="dropPCH" id="dropPCH" onchange="selPCH(this.value)" runat="server">
            <option selected="selected" value="-1">请选择</option>
            </select><br />
            <asp:HiddenField ID="hdPCH" runat="server" Value="-1" />
            订单来源：<asp:DropDownList ID="dropOrderSource" runat="server">
            </asp:DropDownList>
            货到付款：<asp:DropDownList ID="dropDealType" runat="server">
                <asp:ListItem Text="全部" Value="-1"></asp:ListItem>
                <asp:ListItem Text="否 " Value="0"></asp:ListItem>
                <asp:ListItem Text="是 " Value="1"></asp:ListItem>
            </asp:DropDownList>&nbsp; 发货：<asp:DropDownList ID="dropDeliver" runat="server">
                <asp:ListItem Text="全部" Value="-1"></asp:ListItem>
                <asp:ListItem Text="否 " Value="0" Selected="true"></asp:ListItem>
                <asp:ListItem Text="是 " Value="1"></asp:ListItem>
            </asp:DropDownList>&nbsp; 结算：<asp:DropDownList ID="dropClear" runat="server">
                <asp:ListItem Text="全部" Value="-1" Selected="true"></asp:ListItem>
                <asp:ListItem Text="否 " Value="0"></asp:ListItem>
                <asp:ListItem Text="是 " Value="1"></asp:ListItem>
            </asp:DropDownList>&nbsp; 作废：<asp:DropDownList ID="dropDelete" runat="server">
                <asp:ListItem Text="全部" Value="-1" Selected="true"></asp:ListItem>
                <asp:ListItem Text="否 " Value="0"></asp:ListItem>
                <asp:ListItem Text="是 " Value="1"></asp:ListItem>
            </asp:DropDownList>&nbsp;发票：<asp:DropDownList ID="ddlinvoice" runat="server">
                <asp:ListItem Text="全部" Value="-1" Selected="true"></asp:ListItem>
                <asp:ListItem Text="否 " Value="0"></asp:ListItem>
                <asp:ListItem Text="是 " Value="1"></asp:ListItem>
            </asp:DropDownList>&nbsp;<asp:Label ID="Label1" runat="server" Text="锁定人："></asp:Label>
            <asp:DropDownList ID="ddl_lockmanager" runat="server">
            </asp:DropDownList>&nbsp;<br />
            担保交易：<asp:DropDownList ID="dropAssureDeal" runat="server">
                <asp:ListItem Text="" Value="-1" Selected="true">全部</asp:ListItem>
                <asp:ListItem Text="否 " Value="0"></asp:ListItem>
                <asp:ListItem Text="是 " Value="1"></asp:ListItem>
            </asp:DropDownList>&nbsp; 物流单打印：<asp:DropDownList ID="dropExpressPrint" runat="server">
                <asp:ListItem Text="全部" Value="-1" Selected="true"></asp:ListItem>
                <asp:ListItem Text="否 " Value="0"></asp:ListItem>
                <asp:ListItem Text="是 " Value="1"></asp:ListItem>
            </asp:DropDownList>&nbsp; 
            配货单打印：<asp:DropDownList ID="dropDeliverPrint" runat="server">
                <asp:ListItem Text="全部" Value="-1" Selected="true"></asp:ListItem>
                <asp:ListItem Text="否 " Value="0"></asp:ListItem>
                <asp:ListItem Text="是 " Value="1"></asp:ListItem>
            </asp:DropDownList>&nbsp; 
            订货单打印：<asp:DropDownList ID="ddlcusprint" runat="server">
                <asp:ListItem Text="全部" Value="-1" Selected="true"></asp:ListItem>
                <asp:ListItem Text="否 " Value="0"></asp:ListItem>
                <asp:ListItem Text="是 " Value="1"></asp:ListItem>
            </asp:DropDownList>&nbsp; 
            配送方式：<asp:DropDownList ID="dropTraner" runat="server">
            </asp:DropDownList>&nbsp; &nbsp;意见：

            <asp:DropDownList ID="dropOrderSuggestion" runat="server">
            </asp:DropDownList><br />
            选择物流单：<asp:DropDownList ID="dropExpressBill" runat="server">
            </asp:DropDownList>
            <asp:Button ID="Button3" class="input_button" runat="server" Text=">>" OnClick="Button3_Click" />
            保留查询条件：<asp:CheckBox ID="chkCondition" runat="server" />
            <asp:Button ID="clearCondition" runat="server" CssClass="input_button3" Text="清空查询条件"
                OnClick="clearCondition_Click" />
                <br />
                排序：<asp:DropDownList ID="ddlSort" runat="Server" /> <asp:DropDownList ID="ddlSortDrect" runat="server" />
                <br /><br />
            <asp:Button ID="btnSearch" runat="server" Text="查找" CssClass="input_button" OnClick="btnSearch_Click" />
            <asp:HiddenField ID="hdOrders" runat="server" />
            <br />
            <br />
            <asp:Panel ID="Panel1" runat="server" Height="26px" Width="126px" Visible="false">
                <div id="div_xx" style="width: 848px; height: 28px;" runat="server">
                    固定电话：<asp:TextBox ID="txtgddh" runat="server" Width="99px"></asp:TextBox>&nbsp;
                    手机：<asp:TextBox ID="txtsj" runat="server" Width="118px"></asp:TextBox>&nbsp;地址：<asp:TextBox
                        ID="txtaddress" runat="server" Width="202px"></asp:TextBox>&nbsp;商品代码：<asp:TextBox
                            ID="txtspdm" runat="server" Width="91px" AutoPostBack="True" OnTextChanged="txtspdm_TextChanged"></asp:TextBox><br />
            颜色：<asp:DropDownList ID="drpColor" runat="server"></asp:DropDownList>尺码：<asp:DropDownList ID="drpSize" runat="server"></asp:DropDownList>
                </div>
            </asp:Panel>
        </div>
        <div style="margin-top: 10px; margin-left: 10px;">
            <asp:Repeater ID="rptOrderList" runat="server" OnItemCommand="rptOrderList_ItemCommand"
                OnItemDataBound="rptOrderList_ItemDataBound">
                <HeaderTemplate>
                    <table id="SENDDOCList" class="tb" border="0" cellspacing="1" cellpadding="0">
                        <tr class="z1">
                            <td class="zt3">
                                <input id="chkChooseAllSENDDOC" type="checkbox" onclick="ChooseAll('SENDDOCList','chkChooseAllSENDDOC')" />
                            </td>
                            <td class="zt3">
                                意见
                            </td>
                            <td class="zt3" style='<%= LockFlag=="1"?"display:block":"display:none" %>'>
                                锁定
                            </td>
                            <td class="zt3">
                                发货
                            </td>
                            <td class="zt3" style="display: none">
                                结算
                            </td>
                            <td class="zt3" style="display: none">
                                作废
                            </td>
                            <td class="zt3" style="display: none">
                                担保交易
                            </td>
                            <td class="zt3">
                                物打
                            </td>
                            <td class="zt3">
                                配打
                            </td>  
                            <td class="zt3" style='<%= LockFlag=="1"?"display:block":"display:none" %>'>
                                订打
                            </td>                           
                            <td class="zt3">
                                订单编号
                            </td>
                            <td class="zt3">
                                收货人

                            </td>
                            <td class="zt3">
                                昵称
                            </td>
                            <td class="zt3">
                                订单来源
                            </td>
                            <td class="zt3">
                                配送方式

                            </td>
                            <td class="zt3">
                                数量
                            </td>
                            <td class="zt3">
                                用户帐号
                            </td>
                            <td class="zt3">
                                用户姓名
                            </td>
                            <td class="zt3">
                                物流单号
                            </td>
                            <%--<td class="zt3">
                    交易类型
                </td>--%>
                            <td class="zt3">
                                总额
                            </td>
                            <td class="zt3">
                                制单日期
                            </td>
                        </tr>
                </HeaderTemplate>
                <ItemTemplate>
                    <tr onmouseover="Fuscous(this)" onmouseout="Undertone(this)" class="z2">
                        <td class="zt4">
                            <asp:CheckBox ID="chkChoose" runat="server" /><asp:HiddenField ID="hfOrderId" runat="server"
                                Value='<%# Eval("ORDER_ID") %>' />
                        </td>
                        <td class="zt4">
                            <asp:HyperLink ID="sdss" runat="server" Text="" Width="12" Height="12"></asp:HyperLink>
                        </td>
                        <td class="zt4" style='<%=  LockFlag=="1"?"display:block":"display:none" %>'>
                            <asp:CheckBox ID="CheckBox6" runat="server" Checked=' <%# Convert.ToString(Eval("BYZD13"))=="1"?true:false %>'
                                Enabled="false" ToolTip='<%#Eval("BYZD20") %>' />
                        </td>
                        <td class="zt4">
                            <asp:CheckBox ID="CheckBox4" runat="server" Checked=' <%# Convert.ToString(Eval("ORDER_SEND"))=="1"?true:false %>'
                                Enabled="false" />
                        </td>
                        <td class="zt4" style="display: none">
                            <asp:CheckBox ID="CheckBox3" runat="server" Checked=' <%# Convert.ToString(Eval("ORDER_CLEAR"))=="1"?true:false %>'
                                Enabled="false" />
                        </td>
                        <td class="zt4" style="display: none">
                            <asp:CheckBox ID="CheckBox2" runat="server" Checked=' <%# Convert.ToString(Eval("ORDER_DELETE"))=="1"?true:false %>'
                                Enabled="false" />
                        </td>
                        <td class="zt4" style="display: none">
                            <asp:CheckBox ID="CheckBox7" runat="server" Checked=' <%# Convert.ToString(Eval("ORDER_SECDEAL"))=="1"?true:false %>'
                                Enabled="False" />
                        </td>
                        <td class="zt4">
                            <asp:CheckBox ID="CheckBox1" runat="server" Checked=' <%# Convert.ToString(Eval("ORDER_TPRINT"))=="1"?true:false %>'
                                Enabled="false" />
                        </td>
                        <td class="zt4">
                            <asp:CheckBox ID="CheckBox5" runat="server" Checked=' <%# Convert.ToString(Eval("ORDER_PRINT"))=="1"?true:false %>'
                                Enabled="false" />
                        </td>
                        <td class="zt4" style='<%= LockFlag=="1"?"display:block":"display:none" %>'>
                            <asp:CheckBox ID="CheckBox8" runat="server" Checked=' <%# Convert.ToString(Eval("BYZD14"))=="1"?true:false %>'
                                Enabled="false" />
                        </td>
                        <td class="zt4">
                            <a class="lj" href='../DeliverGoodsManagement/InvoiceDetails.aspx?code=<%# Eval("ORDER_ID") %>' target="_blank">
                                <%# Eval("ORDER_ID")%>
                            </a>
                        </td>
                        <td class="zt4">
                            <%# Eval("ORDER_GETER")%>
                        </td>
                        <td class="zt4">
                            <%# Eval("Nike")%>
                        </td>
                        <td class="zt4">
                            <%# Eval("OF_NAME")%>
                        </td>
                        <td class="zt4">
                            <asp:Label ID="lblTranerName" runat="server" Text='<%# Eval("TRANER_NAME")%>'></asp:Label>
                        </td>
                        <td class="zt5">
                            <%# Decimal.Round(Decimal.Parse(Eval("ORDER_QTY").ToString()), 0).ToString()%>
                        </td>
                        <td class="zt4">
                            <%# Eval("ORDER_CUSTOMERCODE")%>
                        </td>
                        <td class="zt4">
                            <%# Eval("GKMC")%>
                        </td>
                        <td class="zt4">
                            <%# Eval("ORDER_TRANBILLCODE")%>
                        </td>
                        <%--<td class="zt4">
                <%# Eval("DT_NAME")%>
            </td>--%>
                        <td class="zt5">
                            <%# Decimal.Round(Decimal.Parse(Eval("ORDER_AAMT").ToString()), 2).ToString()%>
                        </td>
                        <td class="zt4">
                            <%# Eval("ORDER_CREATEDATE") %>
                        </td>
                    </tr>
                </ItemTemplate>
                <FooterTemplate>
                    <tr class="z2">
                    <td  class="zt3" colspan="21"><asp:Label ID="lbl_SL_SUM" runat="server" Text=""></asp:Label></td>
                    </tr>
                    </table>
                </FooterTemplate>
            </asp:Repeater>
        </div>
        <div class="juli">
            <webdiyer:AspNetPager ID="AspNetPager1" runat="server" NumericButtonCount="8" ShowCustomInfoSection="left"
                PagingButtonSpacing="0" ShowInputBox="always" HorizontalAlign="Center" SubmitButtonText="转到"
                NumericButtonTextFormatString="[{0}]" OnPageChanged="AspNetPager1_PageChanged"
                FirstPageText="首页" InputBoxClass="1" InputBoxStyle="1" LastPageText="末页" NextPageText="下一页"
                PrevPageText="上一页" SubmitButtonClass="input_button">
            </webdiyer:AspNetPager>
        </div>
     </div>  
     <div id="div_background">
            </div>
    </form>
</body>
</html>
